using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

public class EditorHelper : Editor
{
    [MenuItem("Tool/CleanMissingScript")]
    static void CleanMissingScript()
    {
        foreach(var obj in Selection.objects)
        {
            if(obj is GameObject gameObject)
            {
                GameObjectUtility.RemoveMonoBehavioursWithMissingScript(gameObject);
                foreach(var tr in gameObject.GetComponentsInChildren<Transform>(true))
                {
                    GameObjectUtility.RemoveMonoBehavioursWithMissingScript(tr.gameObject);
                }
            }
        }
    }
}
